package com.zrh.jsd.service.studydemo.static_proxy;

// 静态代理模式测试类
public class StaticProxyTest {
    public static void main(String[] args) {
        new WeddingCompany(new You()).happyMarry();
    }
}
interface Marry{
    void happyMarry();
}
class You implements Marry{
    @Override
    public void happyMarry() {
        System.out.println("这里是真实对象要干的事");
    }
}
class WeddingCompany implements Marry{
    private Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }
    @Override
    public void happyMarry() {
        System.out.println("这里是代理对象要干的事1111");
        target.happyMarry();
        System.out.println("这里是代理对象要干的事2222");
    }
}